 <%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/10
  Time: 21:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <meta charset="utf-8">
    <title>账号管理</title>
    <link rel="stylesheet" href="/css/main_style.css" />
    <link rel="stylesheet" href="/css/manager.css" />
    <script src="/js/main_function.js"></script>
    <style>
    </style>
    <script>
        function putInformation() {
            console.log(formJson("user_information_form"));
            Ajax.doMethod("/setInformation", formJson("user_information_form"), false, function (then) {
                let result=JSON.parse(then);
                if(result.code==100){
                    alert("修改个人信息成功！")
                }else (
                    alert(result.msg)
                )
            });
        }
        function setUserPicture() {
            let form=new FormData(document.getElementById("picture"));
            Ajax.postFile("/setUserPicture",form,function (then) {
                let result=JSON.parse(then);
                if(result.code==100){
                    alert("上传成功！");
                    document.location.href = "/student/manager";
                }else {
                    alert(result.msg)
                }
            })
        }

    </script>
</head>
<body>
<div id="navigation">
    <div class="navigation-left"><img src="/img/school.png" style="width: 170px;height: 60px;"></img></div>
    <div class="navigation-center"><a>账号管理</a></div>
    <div class="navigation-right">
        <div class="drop-menu" style="float:right;">
            <div class="user-menu"></div>
            <div class="drop-menu-content">
                <a href="/logout">注销登录</a>
                <a href="/rePassword">修改密码</a>
            </div>
        </div>
    </div>
</div>
<div id="broadside" style="height: 1300px;">
    <div class="broadside-logo">
        <h1>欢迎学生</h1>
        <p>${student_id}</p>
    </div>
    <div class="broadside-menu">
        <p><img src="/img/home.png"/><a href="/student/home">首页</a></p>
        <p><img src="/img/manager.png"/><a href="/student/manager">信息管理</a></p>
        <p><img src="/img/vacation.png"/><a href="/student/vacation">申请事假</a></p>
        <p><img src="/img/scholarship.png"/><a href="/student/scholarship">奖学金申请</a></p>
        <p><img src="/img/message.png"/><a href="/student/message">留言板</a></p>
    </div>
</div>
<div id="content" style="height: 1600px;">
    <div class="manager">
        <div class="title"><p>学生个人信息表</p></div>
        <div id="user_picture"><img src="/getImage" alt="" style="width: 200px;height: 210px;background-repeat: no-repeat"/></div>
        <form id="picture" enctype="multipart/form-data">
            <p>上传图片（请上传1M以内，.png格式的图片）：</p>
            <input type="file" name="user_picture"/>
            <input type="button" onclick="setUserPicture()" value="确认上传"/>
        </form>
        <form id="user_information_form">
            <p>护照名：<input name="passport_name" type="text" style="width: 270px" value="${user_information.passport_name}"/></p>
            <p>中文名：<input name="chinese_name" type="text" value="${user_information.chinese_name}"/></p>
            <p>学生类别：<input name="student_type" type="text" value="${user_information.student_type}"/></p>
            <p>国籍：<input name="citizenship" type="text" value="${user_information.citizenship}"/></p>
            <p>性别：
                <input name="sex" type="radio" id="man" value="1"><span>男</span>
                <input name="sex" type="radio" id="woman" value="0"><span>女</span>
            </p>
            <script>
                if ('${user_information.sex}' == 1) {
                    document.getElementById("man").checked = true;
                }
                if ('${user_information.sex}' == 0) {
                    document.getElementById("woman").checked = true;
                }
            </script>
            <p>出生年月：<input name="birth_date" type="datetime-local" value="${birth_date}"/></p>
            <p>宿舍号：<input name="dormitory" type="text" style="width: 240px" value="${user_information.dormitory}"/></p>
            <p>所在班级：<input name="classes" type="text" style="width: 240px" value="${user_information.classes}"/></p>
            <p>入学时间：<input name="start_school_time" type="datetime-local" value="${start_school_time}"></p>
            <p>离校时间：<input name="leave_school_time" type="datetime-local" value="${leave_school_time}"></p>
            <p>护照号：<input name="passport_id" type="text" value="${user_information.passport_id}"></p>
            <p>护照过期时间：<input name="passport_end_time" type="datetime-local" value="${passport_end_time}"></p>
            <p>签证号：<input name="visa_id" type="text" value="${user_information.visa_id}"></p>
            <p>签证到期时间：<input name="visa_end_time" type="datetime-local" value="${visa_end_time}"></p>
            <p>保险到期时间：<input name="insurance_end_time" type="datetime-local" value="${insurance_end_time}"></p>
            <p>经费种类：<input name="expenditure_type" type="text" value="${user_information.expenditure_type}"></p>
            <p>专业：<input name="major" type="text" value="${user_information.major}"></p>
            <p>宗教信仰：<input name="religion" type="text" value="${user_information.religion}"></p>
            <p>获奖信息：</p>
            <textarea name="winning_information" type="text" style="margin-left:60px;height: 70px;width: 300px;">${user_information.winning_information}</textarea>
            <p>手机号码：<input name="phone_number" type="text" value="${user_information.phone_number}"></p>
            <p>微信号：<input name="weChat" type="text" value="${user_information.weChat}"></p>
            <p>电子邮箱：<input name="email" type="text" value="${user_information.email}"></p>
        </form>
        <center><button type="button" onclick="putInformation()">确认修改 </button></center>
    </div>
</div>
</body>
</html>
